Dynomotion

Group: DynoMotion Message: 5447 From: Toby Rule Date: 7/20/2012
Subject: triggering an event BEFORE the end of a feed segment

Hello,

 

Is there a way to trigger an event BEFORE the end of a feed segment?  For instance, maybe I would have an m-code that  says “after the following feed segment, close a laser shutter.  Then, a c-program would run that would monitor the feed segment and trigger the shutter before the end of the segment, accounting for mechanical delay, so the shutter will be closed precisely at the end of the segment.  Would I be able to predict the end of the feed segment inside a C-program?

 

Thanks,

 

Toby

The information contained in this transmission is intended only for the person or entity
to which it is addressed and may contain II-VI Proprietary and/or II-VI Business Sensitive
material. If you are not the intended recipient, please contact the sender immediately
and destroy the material in its entirety, whether electronic or hard copy. You are
notified that any review, retransmission, copying, disclosure, dissemination or other
use of, or taking of any action in reliance upon this information by persons or entities 
other than the intended recipient is prohibited.
Group: DynoMotion Message: 5448 From: Tom Kerekes Date: 7/20/2012
Subject: Re: triggering an event BEFORE the end of a feed segment
Hi Toby,
 
Good question.  It would be helpful to know what kind of Jobs you run such as complex paths with tiny segments or simple geometries with long segments.  Also what would be the length of the delay?  What are your acceleration times and feed rates?
 
I can't think of an easy way to do this but here are some possibilities:
 
C Program:  I suppose a clever C program could be running in the background and observing where we are in the Coordinated Motion Buffer.  It could scan ahead in the buffer looking for an embedded (dummy) SetBitBuf command.  If one was found, it could wait until the segment before it was being executed.  It could then observe the progress of time through the segment and compare it to the specified time duration of the last segment and as soon as it was within the shutter delay time, command the shutter to close.
 
Motion Delay:  One technique I have used in the past for high speed laser scanning was to introduce a delay of the xy commanded motion equal to the shutter delay.  So the trajectory and shutter commands are generated as if there was no delay, but then the trajectory is delayed and fed to the xy axis.  Delaying the xy trajectory but not delaying the Shutter commands results in the Shutter commands leading in time the xy motion.  A digital delay can be implemented with a circular buffer.  For example to delay 9ms with KFLOP's servo sample time of 90us would require a buffer 100 values deep.  To do this in KFLOP would require 2 axis channels per axis.  One axis channel would be a dummy with no output or motor associated with it and used to generate the (un-delayed) trajectory.  These dummy axes would be driven by the GCode and assigned in the DefineCoordSystem().  The other set of axis channels would be the real motor axes (Servos or Steppers).  A C program would continuously copy a delayed version of the axis Destinations from the dummy to the real axes.
 
Close on Slow:  Would it work to just close the shutter when it looks like the axes are coming to a stop?  ie.  Speed dropped below a certain threshold and we are decelerating?
 
Any thoughts?
 
Regards
TK
 

Group: DynoMotion Message: 5458 From: Toby Rule Date: 7/23/2012
Subject: Re: triggering an event BEFORE the end of a feed segment

HI Tom,

 

Thanks for the suggestions.  I knew this would be tricky.  I think my first thought was to manipulate the coordinated motion buffer, but I don’t have a clear idea where to start with this.  Which parts of the API support this?  I think I just need pointed in the right direction.  Maybe you have a post explaining this process.

 

Also, if I could read instantaneous axis velocity, that might be helpful.  It may be that for the timings involved, I can just predict the stopping-point based on the acceleration curve.  I looked through KMotionDef.h and PC-DSP.h  and couldn’t figure out how to do this. 

 

Thanks,

 

Toby

 

From: DynoMotion@yahoogroups.com [mailto:DynoMotion@yahoogroups.com] On Behalf Of Tom Kerekes
Sent: Friday, July 20, 2012 3:02 PM
To: DynoMotion@yahoogroups.com
Subject: Re: [DynoMotion] triggering an event BEFORE the end of a feed segment

 

 

Hi Toby,

 

Good question.  It would be helpful to know what kind of Jobs you run such as complex paths with tiny segments or simple geometries with long segments.  Also what would be the length of the delay?  What are your acceleration times and feed rates?

 

I can't think of an easy way to do this but here are some possibilities:

 

C Program:  I suppose a clever C program could be running in the background and observing where we are in the Coordinated Motion Buffer.  It could scan ahead in the buffer looking for an embedded (dummy) SetBitBuf command.  If one was found, it could wait until the segment before it was being executed.  It could then observe the progress of time through the segment and compare it to the specified time duration of the last segment and as soon as it was within the shutter delay time, command the shutter to close.

 

Motion Delay:  One technique I have used in the past for high speed laser scanning was to introduce a delay of the xy commanded motion equal to the shutter delay.  So the trajectory and shutter commands are generated as if there was no delay, but then the trajectory is delayed and fed to the xy axis.  Delaying the xy trajectory but not delaying the Shutter commands results in the Shutter commands leading in time the xy motion.  A digital delay can be implemented with a circular buffer.  For example to delay 9ms with KFLOP's servo sample time of 90us would require a buffer 100 values deep.  To do this in KFLOP would require 2 axis channels per axis.  One axis channel would be a dummy with no output or motor associated with it and used to generate the (un-delayed) trajectory.  These dummy axes would be driven by the GCode and assigned in the DefineCoordSystem().  The other set of axis channels would be the real motor axes (Servos or Steppers).  A C program would continuously copy a delayed version of the axis Destinations from the dummy to the real axes.

 

Close on Slow:  Would it work to just close the shutter when it looks like the axes are coming to a stop?  ie.  Speed dropped below a certain threshold and we are decelerating?

 

Any thoughts?

 

Regards

TK

 

 

From: Toby Rule <trule@...>
To: "DynoMotion@yahoogroups.com" <DynoMotion@yahoogroups.com>
Sent: Friday, July 20, 2012 8:25 AM
Subject: [DynoMotion] triggering an event BEFORE the end of a feed segment

 

 

Hello,

 

Is there a way to trigger an event BEFORE the end of a feed segment?  For instance, maybe I would have an m-code that  says “after the following feed segment, close a laser shutter.  Then, a c-program would run that would monitor the feed segment and trigger the shutter before the end of the segment, accounting for mechanical delay, so the shutter will be closed precisely at the end of the segment.  Would I be able to predict the end of the feed segment inside a C-program?

 

Thanks,

 

Toby

The information contained in this transmission is intended only for the person or entity
to which it is addressed and may contain II-VI Proprietary and/or II-VI Business Sensitive
material. If you are not the intended recipient, please contact the sender immediately
and destroy the material in its entirety, whether electronic or hard copy. You are
notified that any review, retransmission, copying, disclosure, dissemination or other
use of, or taking of any action in reliance upon this information by persons or entities 
other than the intended recipient is prohibited.

 

The information contained in this transmission is intended only for the person or entity
to which it is addressed and may contain II-VI Proprietary and/or II-VI Business Sensitive
material. If you are not the intended recipient, please contact the sender immediately
and destroy the material in its entirety, whether electronic or hard copy. You are
notified that any review, retransmission, copying, disclosure, dissemination or other
use of, or taking of any action in reliance upon this information by persons or entities 
other than the intended recipient is prohibited.
Group: DynoMotion Message: 5460 From: Tom Kerekes Date: 7/23/2012
Subject: Re: triggering an event BEFORE the end of a feed segment
Hi Toby,
 
The internal operation of the Coordinate Motion Buffer is not documented well.  There is an example CoordMotionInKFLOP.c that demonstrates how to put segments into the buffer. 
 
Basically:
 
extern PARAMETRIC_COEFF *CoordSystem0;
is a global pointer to what is currently executing in the buffer.
 
The PARAMETRIC_COEFF type is defined in KMotionDef.h.  The member trajectory_mode can be:
 
#define
TRAJECTORY_OFF 0 // no trajectory generation
#define
TRAJECTORY_LINEAR 2 // linear interpolated from coord system 0 (x = c*p+d)
#define
TRAJECTORY_CIRCULAR 3 // circular interpolated from coord system 0 (x = c*sin(p*a+b)+d)
#define
TRAJECTORY_SPECIAL 4 // Special Command to clear/set IO bit
// command 0 = ClearBit command 1 = SetBit
// param 0 = bit number
 
The Coordinated Motion Buffer is a circular buffer, so to advance a check for wrap around is required such as:
 
 if (++ParametricIndex == MAX_SEGMENTS) ParametricIndex=0;   // wrap the buffer             
The current time value for the current segment is the global variable:
 
extern double CS0_t;
If you have further questions don't hesitate to ask.
 
Regarding checking for an upcoming stop.   The Acceleration would normally not be a curve.  Rather it would be a constant either Positive, Negative, or zero (when stopped or constant velocity).  The Channel Structure has a field
 
ch->last_vel
 
Which should be the velocity for the axis's trajectory in counts/sec.  You probably would want to compute the xy feed rate by doing the sqrt of the sum of the squares.  When the speed first drops below a threshold this would indicate a deceleration and low speed so a stop should occur soon.
 
 
HTH
TK